Add exceptions and line tracking