multiple improvements based on feedback from @freeformz