Fixed some bugs, added some printing