probably makes sense to explicitly test corrct string length at some point too, eh?
we can use math.huge here now, so avoid extra str.length calls