Adding the type function
OR expressions check for null
removing debug statement