code cleanup, formatting, other minor changes