completed assignment

functions have been tested. Should include comments.