more fully workinf version