Handling edit to undefined. Memory cleanup
Sanitize text directive