Refactor some to make it readable