All functiosn passing after refactoring