Fixed Tests, now all working
and refactored sql scripts a bit