Created enumeration for error (and other) codes.
Created general optimization interface.