Finished edditing the changes for balance factor and removed some unsued codes.