Refactoring of code