some refactoring done