Extract code to parent class