Refactor all the things

@gf3 & @alexblackie