Added getters/setters and modified current logic to use them instead of directly accessing data members.