refactored to pass CR tests