Refactor to be easily understood