Made parsing slightly more robust