Fixed some bugs and modified the problem.