beautified the success flash code