Added checking for duplicate and non-existing names