refactor table printing into separate class