Add improved solution using filter and count