Added some new features and fixed some bugs.