bunch of code review/cleanup