Refactor pirntable()