some refactoring and added export