merge code from Rob's web end