r17525: This is a merge from the Google Summer of Code 2006 project by Martin Kühl