modified script to be a global npm module - improved memo file function