Minor fixups
Refactor scripts