code simplifications and cleanups.