Starting to rewrite and add tests for 2.0