merging Mallory's column sorting changes