first round of code cleanup