Cleaned up data types and coding style, fixed function headers for Layer 0 and Layer 1