refactored implementation details into own package