Alternative solution, using "library functions".
Editorial improvements.