Compare types using isinstance

Plus small formatting fix