added some comments and a minor bugfix where arg is touched before its defined in certain case