While the retinex theory aimed at explaining human color perception, its derivations have led to efficient algorithms enhancing local image contrast, thus permitting among other features, to "see in the shadows". Among these derived algorithms, Multiscale Retinex is probably the most successful center-surround image filter. In this paper, we offer an analysis and implementation of Multiscale Retinex. We point out and resolve some ambiguities of the method. In particular, we show that the important color correction final step of the method can be seriously improved. This analysis permits to come up with an automatic implementation of Multiscale Retinex which is as faithful as possible to the one described in the original paper. Overall, this implementation delivers excellent results and confirms the validity of Multiscale Retinex for image color restoration and contrast enhancement. Nevertheless, while the method parameters can be fixed, we show that a crucial choice must be left to the user, depending on the lightning condition of the image: the method must either be applied to each color independently if a color balance is required, or to the luminance only if the goal is to achieve local contrast enhancement. Thus, we propose two slightly different algorithms to deal with both cases.