Optimize student code