CS241 Machine problem. The copyright of part of the code belongs to University of Illinois.