coding up ring analysis. not finished yet