Moved Encode to the proper file.