Final (for this commit series) optimized version and with commentary section.