Moved pathname split to variable to make code more readable and more efficient.
Using array length instead of checking if keys exist.
Replaced ' with " for consistency.
Added some spaces.
Merge pull request #4 from edgy360/master

Code Optimisations