Updated string building. Forced used of urlencode everywhere on the code. Did some minor refactoring