Added some features and fixed lots of bugs. This is worth pulling down.