Refactor to make things readable