refactored db adapter into separate class
catch missing contents case; code formatting