refactored msd into a class