Changes to the port proposed by kwm.