refactor to simplify and follow requirement