cleaning up some *cough* crappy *cough cough* code