Minor changes to code, and removed previous versions