Extracting abstractions and creating subclasses