getSelection as private function