Reduce visibility of some methods and rearrange inner classes.