Add filter and append functions and unit tests