Add time tests, make a few runtime improvements