making  parameter for filter optionnal; fixing flatten
adding indexBy function
adding sample function
PSR-2