Library functions, simple filter and tests