Script ammended
Functions renamed