Added and tested both functions