refactored with private data and getters/setters