Added Login Stuff for M4 and output text file stuff

wif Michael Falk