several fixes and improvements, managers moved as functions and not methods