refactoring with the given review suggestions