1 ) A portable smartcard device for executing program code upon receipt of a command from a host system, the smartcard device comprising: a) at least one interface for presenting smartcard functionality to the host system and for receiving the command from the host system; b) a non-volatile memory for storing the program code before program execution; c) an executable memory for storing at least a portion of the program code during program execution; and d) an internal copying mechanism for copying said at least a portion of the program code to said executable memory.