Promote the substring calls to variables. ctx probably isn't the variable name too.