Ameded the structure of the functions file - needs more work