Writing commands to history in custom funcs