some refactoring
to tmp