moved the last mod stuff into if statement