Refactoring of redundant code.