refactor calculation of bounds path