Added functions for Assignent 2