Refactored to make it faster than GSON