manually inlined a few definitions