added tlength to calculate the length of yrec-cut
merge with master at pontus computer