More comments, some checks
filter.c: write_all instead of puts