Major refactoring for 3.0.0--see notes