Switched from getPath to calculate path as it is a heavy method