programming assignment 2  functions updated