ugly implementation of filter, too