1) added null check

2) encapsulated field