a little cleanup and rearrangement