working version with no shuffle