Fixed some bugs, added some new methods