Added tests and cleaned up a bit