Helper functions for processing trait data
Moved helper functions to separate file