Initial commit.
Complete rewrite