Replace crappy code with abstract class