Fixed bug with initializing endingLength twice and not initializing beginningLength.