Refactor code for readability