filled in functions per Assignment 2 specs