WIP, might be fixed, going to clean up now. This branch can probably be discarded.