Made some changes to better handle rooted URLs (issue #50).
Also some refactoring and removal of redundant comments for readability.