Defining methods for an S4 class