some refactaring