optimized callback using closure. closure is amazing feature of javascript.