Fixed a bug and added a feature