Fixed faulty database scripts (future scripts should use versioning!)
Refactored db scripts