delete function workinf
cleaning up ui and eror handeling