Basic code for registering functions