Done.
This is really weird, It was indeed like that but with barLen = 0 it was crashing, but I am trying now and it is not crashing.. Maybe it was something else and I though 0 length was causing it. It is indeed much better now.