Rearrangement, cleanup and fixing