copy some more code around