create local var to access outer variable from inner class
implement nested inner class as closure instead so it can access the global def