implemented functions
 updated function signature incase it matter for grading