added some testing stuff.
fixed some bugs