Add a few new features and a lot more tests