added tag filtering. warning: potentially buggy