improved signature detection