Cleaned up the code and added support for zip archives.