added toggle to optimize button