Added type checking