solver class almost finished