Made parsing robust to packages.json main inaccuracy. Fixed function code parse bug