Changing if and case to use a collector instead of the api function api_interface:pos_to_node/3