working on filter and reformat some code