Incorporate fixes from Dave