some new test cases and rewrite of code that went lost in one of the last pull requests
implemented database tests. once case failing(don't know if i found a bug or the test is wrong, will seet to this later
Merge pull request #86 from NicolasKessler/master

More Tests implemented