A more robust way of deciding between integer or string for typing