backend: move grid selection logic to controller