extended compression, better error-checking