refactor and creation of abstract class