Refactor QueryString and Cookie parsing to be more reusable