Updates to pass the test and minor bug fixes. Tests need a major refactoring