Refactor some things