Small refactor to solve_cramer