some refactoring..