added exception aware supplier function + some refactoring