Added null checking.
Renamed a private method to be more descriptive.