implement jim's suggestions
merge with jim