extract function registration logic so that each function is completely self contained