added code to functions