Added error tracking