Initial commit of complete rewrite.