unite two similar scripts