bug in CompletableFuture fixed;
small cleanup;
class Function refactored.