minor changes
Tested code for database :-)

Includes the first testing enviroment