more annotation; memoize; tests