Refactored parameter encoding to iterate over object directly
Refactored signature generation to make it more readble