Added headers and function stubs and math library also minor improvements to existing C functions.