Moved parts into one c file