moved functions out to solver package