refactoring, added extra function "all"