cleanup some constants, add newton raphson for fast convex optimization