added tests for various classes, fixed some bugs