Fix Bug and Add Test on Main Class