finally got things working-ish. now gotta rewrite the demo