variant
almost working script
working script