Tweaked port to match documentation