Fixed a few minor bugs
Added I/O primitives