pulling out sorting from click for testing