working on the 3 functions