Added path calculation from length+bug fixes