Finished the two functions required