added to_hash method and hash_filter coderef to new constructor to filter