wrapping up, basic error checking, remove timings debug