Fixed issue in db init scripts, added requirements, updated readme, various refactorings and test fixes