fixed the sim bug, updated the tui to use timeout() instead of halfdelay() for a better time resolution.