Cleaned up code a bit.
Encoding the X-File-Name header with encodeURIComponent now.

Closes #166