Updated solution for step 3