More tests

Fixed code and added more tests