(updated) Completed homework assignment