Massive rewrite for 2.0.0 - see changelog