Added javadoc to most of the classes.
Changed most classes to abstract to make it more extensible.