rewrote some function, filter added