Fixed some of the major bugs.