Yury: made messages more informative. Also define function for DB
updating.