Copied from MrDoob

No changes immediately needed