more detailed timing functions
fix asserts, makes code much faster