Furious refactoring, trying to figure out a good way to handle request headers