Refactored runEncodingPass() into AbstractEncoder class and refactored encoder-specific parts into the corresponding Encoder classes.