Moved function definitions to solver.cpp