Simplify app script for google sheets

Hi anyone knows how I can simplify this code?
This is working, however it takes time to update the datetime column

function onEdit(e) {
var row = e.range.getRow();
var ws = “Consults Form Responses”;
if(row > 1 && e.source.getActiveSheet().getName() === ws)
{addDateAnswered(e);}
AllFormat();
}

function addDateAnswered(e){
var row = e.range.getRow();
var validity = e.source.getActiveSheet().getRange(row,14).getValue();

if(validity == “VALID” || validity == “INVALID”)
{setDateAnswered(e);}
else if(validity == “DUPLICATE” || validity == “NFA”)
{e.source.getActiveSheet().getRange(row,17).setValue(validity)}
else
{e.source.getActiveSheet().getRange(row,17).setValue(“PENDING”);}

var AllRange = ws.getRange(“A2:P”);
AllRange.setVerticalAlignment(“middle”);

var AllCenter = ws.getRange(“A2:A” && “F2:F” && “J2:K” && “M2:M”);
AllCenter.setHorizontalAlignment(“center”);

var TestLeft = ws.getRange(“O”);
TestLeft.setHorizontalAlignment(“left”);
}

function setDateAnswered(e){

var row = e.range.getRow();
var col = e.range.getColumn();
var TimeStamp = Utilities.formatDate(new Date(), ‘GMT+8:00’, ‘MM/dd/yyyy hh:mm:ss a’);

if(col === 14 && row > 1)
{e.source.getActiveSheet().getRange(row,17).setValue(TimeStamp);}
}

Go to Source
Author: KB John