Refactor some ugly stuff