Refactor some minor stuff