major refractor and bunch of new features