first 3 functions from website added