cleanup, rearrangement, tiny fixes