refactor out range parsing and inputstream limiting features