Changed all files and added safeguards.