Fixed some bugs, added some new options.