replaced json_encode and json_decode with string parsing, this is much faster.