Adding logic for properly storing and retrieving timestamps from the DB; fixing some DAO bugs; adding some exception handling