refactoring the vertical columns logic - made them more uniform so that they can be generalized