dynamic sorting printing works