Inlined some functions