Refactored for shared code