Encapsulated code segments