Print hex for clarity.
Fix some bugs and add simulation file. Seems like it's off by one (doesn't get the first input).