Code refactor

- code refactoring after code review