Added function headers and fixed tabbing