Make basic ECOS work with CVX + minor refactoring