small tweaks and code cleanup