Refector code a bit. Add filtered buffer.