Updated Functions Code