Improved the class structure, hunted the bugs.