Minor changes, delelted unused variables etc.