mltries fully commented + partial management of empty path + code refactoring