functions created and tested