update 5: my functions for assignment 2