moar refactor
it compiles at least