Touched up linux implementation, fixed realloc linux problem