refactored to limit dependency issues and make for cleaner reusability