added saving results to database; ready for memcached