Merged Avery's changes