functions for assingment 2