created functions for assignment 2