Fixed Spaghetti and Added More Comments