Added some contraint checks (existance, duplicates)