added optimization back