Improved target detection and exception handling