Cleaned up code.  Added encoding base on both source and target languages.