removed wasted command for trimming the requested path before comparing to static left part of url
restructured some more code.