Huge gode refactore and fixes encoding troubles