some extra fixes, reorganization