code improvements, clean-up after initial review