save duration
better error handling