added johns code
more changes