Homework 3 improvement