This can be combined by just initializing headers to an empty map instead of null