feature complete final analysis; needs some polish