First working version with quick analysis.