implementing assignment2 - first version