[cleanup] move some code around and try to pretty things up a bit