Neater isinstance function