Set filename in response headers too.
Strong refactoring after review.
Add docstrings for all functions/helper functions.
Merge pull request #2 from catlee/staging

Staging