Refactor the crap out of it