changes in database layer, base class, added comments.