refactor mode inheritance