Refactor to make things easier to read