Fixed compression issues, added tests