created and tested both functions