factor request handling into standalone translation unit