Move socket include for connection struct.
Clean up little endian conversion.
Start core build function.
Convert more Lua functions.