Fixed database so that name is unique. and some small changes