Changed to C based functions rather than ASM leaf functions