added original cpp script, written in 1999