the script _messy implemented. see README for remaining TODOs