refactoring & abstracting classes