Updated solution for step 1