changed logger to static
optimized getPathToRoot