smaller fixes, code cleanup