Refactor to make more readable