tidy up script for resend button