Patch based on work from James Peach <jpeach@sgi.com> to convert over to