some refactorings for better usability and maintenance