begin to add module. refined all encode operations