Privatized some variables, deleted unreferenced variables