New features and added a lot of tests and a lot of refactoring

Tony! Tests are passing, we are ready to merge with the mothership