refactored unit_of_work, completed pending tests