Making Encode Optional

Added the encode parameter, defaults to true.