refactor to account for bz2