first draft of solve script