zip: optimizations to deflate logic. general optimization and cleanup.