working code, still need to filter more