externalize helper function for columns merge
minor refactoring - more clear variable names