Implement working Unit5-HW1 solution