level1: refactor trans function