refactor some stuff