fixed some bugs and added new docs