Refactored redirectmsd module to at least make the existing module readable and understandable before potentialy refactoring