Refactor mode set