some refactroring