Class definition and methods