Corrected most bugs and did overall improvements.