finished implementing database code and intercepting messages