Initial version, mostly complete