Refactor Code