Refactoring to abstraction and renaming some  classes/variables