The initial patch by bzt with my minor edits. git-svn-id: svn://kolibrios.org@9958 a494cfbc-eb01-0410-851d-a64ba20cac60