adding file input/output for easy scripting.
TODO: fix the command stack popping when it reaches EOF