merged with the work from Tim

Works.