applying corrections from Tom Diepenbrock