homework-4 (fourth commit)

Fully working version.