Fixed Several Errors In The Code