Updated code to try and get test cases to pass before trying to refactor