implemented __invoke method