Object-oriented version