Added validation; improved situation about unique constraint