refactoring and consolidating separate classes