Added some checking