Refactor a bit for more clarity