Initial commit from about a night of hacking on it