Better logic implemented in em3dterminal and some checks in EM3Dfile added.