Refactor with abstract class