Add type checking in the methods