Refactored masquerade and http stuff into their own files