Implemented level path algorithm