Include icns file extension when missing in Info.plist entry
Refactor into module structure

This module-based structure makes it easier to see what's going on, and
should make it easier to maintain.

This commit also adds various comments for the modules and functions.