some refacorting