Reshuffle code around for orderliness