added unique constraint to init.sql, made some changes due to exception
handling