Polish DB and Input

- Fix DB to work properly
- Fix uniqueness validation