Revise code as suggested