Added some safety measures