Updated solution for step 5