Fixed message ordering and optimized memory usage