progress on faster version of compression
fixed bug in previous commit
fixed bugs and compression procedure, now agrees with unoptimized version