Batch job module finished and working
Various refactorings, added db scripts, improved tests