Replaced my unix hackery with proper ruby filtering