done some refacturing