fixed mispasted files, removed more pass by reference code, updated