refactor like function