First homework - rewritten