Added source code provided by Dr. Griffioen