Tweaking here and there, almost compiles