script modified to be slightly more configurable