Added some methods, fixed some bugs.