update 1: my functions for assignment 2