Refactored to use dynamic fragment management