implementing sorting controls