add script support & cleanup a bit