rewritten the command loop of loginengine