type classes added, lots of bugs resolved