some refactoring ;)