Make mode parsing and application more readable and efficient