implementations for homework 1