add some docblocks and properly handle null request object