Refactor Code 2