support for * as a mode target

refactor mode setting, support for '*' as a mode target