Added filtering of headers to reshape_data function