Add function headers and fix file formating