Many thanks to Anonymous that pointed out a bug. Fixed version.
Also updated the link in the previous post.