Solution
UPDATED