Simplified control structure, Made trailing slash needs/expectations 

Hey @dylanjbarth,

Fixed the issues you were seeing--turns out that `os.path.basename` returns blank if it's passed a trailing slash.  So the fix there was to remove trailing slashes there.

`path` requres a trailing slash, so I made all that explicit.  I also simplified the control structure--let me know if it works for you!

My test:
![image](https://f.cloud.github.com/assets/4072455/1695228/6b7825b4-5eae-11e3-8849-1e9ba6eed07b.png)

![image](https://f.cloud.github.com/assets/4072455/1695220/4d86b53e-5eae-11e3-8910-b25d34a549cd.png)

![image](https://f.cloud.github.com/assets/4072455/1695231/756db232-5eae-11e3-9ce2-4c4f66108a24.png)