New identifyForm function (fixes #649).

Based on code from @axel-angel but rewritten in a more lightweight
style (IMHO, at least :).
Typo.
Golf around on identifyForm :).
Merge pull request #690 from meteficha/identifyForm

New identifyForm function