Updated version from the savage-code site