Added solution in comments