analysis complete - still need better file writing