This article has been replaced with two newer ones on this blog. Also the source code has been replaced with a new version.

Click here