In general, use commas to set off clauses, phrases, or expressions that are introduced by "as explained", "as said", "as commented", "as declared", "as stated", or similar terms.
At the start of a sentence, use a comma after "if necessary", "if needed", "when required", "where needed", etc. Normally, we don't need a comma before "if necessary", "when needed", etc. in mid-sentence or at the end of the sentence.
If "until" or "till" comes at the start of the sentence, use a comma after the clause introduced by "until"—a clause is a group of words that contains a subject and a verb.