fixed up code and removed old stuff