Got detection basically correct