Code Clean Up

Created new Functions
Iteration over Optimizer
Removed unused Lines