Motivating students with optimal challenge in an open learning environment