mostly fixes and rearrangements