added the original perl script