initial version, header roughly correct