I finally put together a detailed description together with full source code:
Thanks for all the feedback!