Update factory to ensure correct order