First attempt hw2-3 complete