expansion function to capture the valid ordering variants