Minor code/readability improvements

This pull request includes my HasPrefix merge request, so apply that one first  one to be merged first. This pull request flow is really confusing.