added memory and history functionality