proper encapsulation and code cleanup