add needed extra spaces and missing headers