Added code for functions.