implementation of the command history