added driver code
script now works, fixed bugs