added script support and various other small changes