i really need to refactor this