Refactor code to whole