code cleanup, misc updates