Added endless loop protection and memory address protection.