Added more tests and fixed a bug in the DeclarativeMemory.