Changed encode and decode functions to operate with correct number of arguments and return single value.
Merge remote-tracking branch 'origin/master'