intermediate first version
optimize intermediate