port from danieldelaney.net