Cleanup all Code
Fixed several Bugs which cased the application to crash if the Database was empty