Fixed bug and changed class names to be easier to understand.