draft of real sem dist func