Added code to functions