Modified to incorporate changes as asked in assignment2(lexical scoping)