second stage compression routines