added critical optimization