Refactor to make the code clear