re-order things and clean up