refactored for less dependencies