solution without filtering