applied init settings, added mode detection