Moved filter to file of its own
Added spec for filter
Added filtering to hash and array writer