several fixes and "cleaning up"