Make script more flexible