copied from PyProg 1415a