Fragment management code optimizations