Now compiles, refactor