Fix issues found during code review

 - Increase use of auto
 - Simplify use of emplace
 - Improve comments and documentation