Refactor to abstract class