code reshuffle, adding autosmooth toggle - untested