Cleanup of memory management (cuz it wasn't right!)
Fixed byte ordering issue