adding filtering back in and fixed open file error