move threshold to layout