add x-axis detection
add threshold