Finished the review code and fixed some bugs