start of encoder