Updating optimizer and splitting it in several files