Generate calc fragments dynamically now rather than in XML