Support offset and length so that one doesn't have to substring, see #602
move actually private methods to proper place, see #602