Working Program all 3 functions.