working stuff for database construction