Updated with my solution