working on the two functions