Initial loop to parse data