Third commit to add the code for both functions