Decided to add checks for null pointers where appropriate.