Inlined version.