Code cleanup
Use type instead of isinstance in parsing