refactor code and add permessage-snappy support