Finished undefined behaviors. Tedious! Clean up later...