added docs, made improvements in the optimizer
added new code for optimizer, added the optimizer interface