some refactoring (code is not compilable!)