move type selection to inner class