Implemented the first three functions