clean up nano encoder code