Fixed some timings that were too optimistic, and attempted to write some asserts, but I haven't been able to test them yet due to the locked file issue on ts-card.