Remote db tests partially working
Major tests refactor