initial implementation of functions for programming assignment 2