Refactor code to make it clear