using inner class instead of lambda