Moving more code from CoAnSys, adding copyright