This code is taken from DEBiL packege developed by Jonathan Devor.
http://www.cfa.harvard.edu/~jdevor/DEBiL.html
