refactor code cleanup