code improvements, cleanups