Last refactoring of code for MLS