Added analyze code

Simplified some code for just plotting