Cherry-pick duck application improvements

@davideaster would you mind reviewing?