Created two functions required by the assignment