renamed to_optimizer_h to to_h for simplicity (refactor based on PR notes)