Move request stuff to separate file