added memory function