Decode and encoding support

Also various performance increases. Now uses python to perform the
parsing.