updating script to be a little more dynamic