added more testing fixed some bugs