refactored with magic methods