Error checking and timing added