First version, pretty much complete