added more tests and code to accept /w/index.php also. refactored split(..)