Add timeout. Closes #295.