huge Memento cleanup + minor pointer bug fix