Finished basic analysis code