More progress. will write something more detailed when i squash this branch...