swap around code so prev + next go correct direction