[RFC] Refactor codebase

cc @mlubin @IainNZ 
Gurobi does it often for SOCPs...