Formatting consistencies: replace tabs with spaces and fix else if block.
Discard compressed output when it exceeds the input size.