Refactoring

some refactoring performed.