code cleanup. thanks jimmyhillis for code review