Refactor using subclasses/define classes