Refactoring (once again)