Refactoring almost done, heinz compiles again