Added function definitions for processing data