Added main scope deallocation of local variables.