move MSI code to new file