Amendments according to code comments by jamezp