Added some safety features