rearrange and document helper scripts for clarity