Fixed messy code and weird naming conventions.