inlined several functions