Add new features and fix some bugs