Added the code for analyzing. It's not yet complete by the way.