a bunch of changes. sort of almost works now