simplify the script and hope it works for everyone