Versions with and without unions.
Refactoring, formatting.
Added basic I/O functions.