Refactoring of code. Methods for web app