code
some refactorin