refactored for easier use