Added some type validation.