Thanks for the post, it's near perfect in focus, detail and how it's written.
EDIT: You have some minor typos in the post (psuedocode)