Merging Tims code

Merging Tims code