Adding encoder test code