Updated functions file