Cavity lenght adjustment and output FEL intensity optimization