created data access layer, added more logging