implementing better encapsulation