refactored to account for dependency cycle