Fixed bug from issue #2. Added compression when done.