Refactor to make more straight forward