added trimming by default to boundary detection