nearing final version, this commit is without Andy's most recent changes