Refactored to remain closer to original method