Refactor of Code