analysis rewrite, fixes #45