[#52] Rewrite type guessing
[#52] Speed up type guessing (3x faster)
[#52] Code style