Improved way of finding the maximum length of the column as per @ralphbean's suggestion