Submitted by: Kengo Ichiki <ichiki@ualberta.ca> Slightly modified so that his patches fit ports policy.