Completed assignment 1 improved