REFACTORING Split it up.

Moved 'compressing' routine to a separate file.