Merge "Move two functions to encoder"