restructured code, added function to extract HTTP verb