refactor to make it slightly less mental