Fixed bugs

Added duplicate feature (untested)