Refactoring of code structure