untested devcode backup

I WILL DEBUG THIS TOMORROW. MOSTLY WRITTEN WHILE DRUNK. GOODNIGHT