added correct functions for assignment 3