Changed the way script gets name

Instead of hard coding the length of file, code now splits based on
directory structure and pull the last string. Note: this will fail on a
windows machine.