Big refactoring
fixed some bugs(directory processing, case insensitivity for path,...)
add new impl