Refactored column function