hcat improved to maintain column names