major bugfix and code improvement.
major bugfix and code improvement for better compression.
two minor whitespace issues.