Unit Tests add and corrections
Fix db close connection in main algorithm