added memory manager; fixes #12