Merged Miguel code
Miguel updates merged