refactoring once more...