Update detect

Changed to a generic detection mechanism