Updated homework solution