added changes for online optimization