Refactored code. Changed checking request parameters in historydb-fastcgi.cpp. Used async results in get_activity().