refactoring, added setup wizard stages detection