Initial commit of big rewrite.
Ref http://forum.dlang.org/thread/ateoelbtvdptffqekcld@forum.dlang.org