A little cleanup, make script more dynamic