Added null checking in all public/protected methods. (need smore tests to achieve 100% coverage)