Fixed code to work with tests