remove unused var encoder.state and source.state